/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package SubsitemaAgenda;

import SubsistemaPaciente.programaMedico.DialogoInfoProgramaMedicoDipreca;
import SubsistemaPaciente.programaMedico.DialogoInfoProgramaMedicoFonasa;
import SubsistemaPaciente.programaMedico.DialogoInfoProgramaMedicoJeafosale;
import javax.swing.ImageIcon;

/**
 *
 * @author mario
 */
public class DialogoTipoPrograma extends javax.swing.JDialog {

    /**
     * Creates new form DialogoTipoPrograma
     */
    String rutPaciente; // utilizado para cargar automaticamente el paciente en algun programa
    public DialogoTipoPrograma(java.awt.Frame parent, boolean modal,String rutPaciente) {
        super(parent, modal);
        initComponents();
        this.rutPaciente=rutPaciente;
        this.setIconImage(new ImageIcon(getClass().getResource("/GUI/Img/logo2.png")).getImage());
        this.setTitle("Tipo de programa");
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        campoJeafosale = new javax.swing.JRadioButton();
        campoDipreca = new javax.swing.JRadioButton();
        campoFonasa = new javax.swing.JRadioButton();
        botonAceptarTC = new javax.swing.JButton();
        botonCancelarTC = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        campoJeafosale.setText("Jeafosale");
        campoJeafosale.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                campoJeafosaleActionPerformed(evt);
            }
        });

        campoDipreca.setText("Dipreca");
        campoDipreca.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                campoDiprecaActionPerformed(evt);
            }
        });

        campoFonasa.setSelected(true);
        campoFonasa.setText("Fonasa");
        campoFonasa.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                campoFonasaActionPerformed(evt);
            }
        });

        botonAceptarTC.setIcon(new javax.swing.ImageIcon(getClass().getResource("/GUI/Img/Aceptar.png"))); // NOI18N
        botonAceptarTC.setText("Aceptar");
        botonAceptarTC.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonAceptarTCActionPerformed(evt);
            }
        });

        botonCancelarTC.setIcon(new javax.swing.ImageIcon(getClass().getResource("/GUI/Img/Cancelar.png"))); // NOI18N
        botonCancelarTC.setText("Cancelar");
        botonCancelarTC.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonCancelarTCActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(15, 15, 15)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(campoFonasa)
                        .addGap(16, 16, 16)
                        .addComponent(campoDipreca)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(campoJeafosale))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(25, 25, 25)
                        .addComponent(botonAceptarTC)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(botonCancelarTC, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(16, 16, 16)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(campoFonasa)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(campoDipreca)
                        .addComponent(campoJeafosale)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 13, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(botonCancelarTC)
                    .addComponent(botonAceptarTC))
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void campoJeafosaleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_campoJeafosaleActionPerformed
        campoDipreca.setSelected(false);
        campoFonasa.setSelected(false);
    }//GEN-LAST:event_campoJeafosaleActionPerformed

    private void campoDiprecaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_campoDiprecaActionPerformed
        campoFonasa.setSelected(false);
        campoJeafosale.setSelected(false);
    }//GEN-LAST:event_campoDiprecaActionPerformed

    private void campoFonasaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_campoFonasaActionPerformed
        campoDipreca.setSelected(false);
        campoJeafosale.setSelected(false);
    }//GEN-LAST:event_campoFonasaActionPerformed

    private void botonAceptarTCActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonAceptarTCActionPerformed
        // TODO add your handling code here:
        this.dispose();
        if (campoDipreca.isSelected()) {
            DialogoInfoProgramaMedicoDipreca dialogo = new DialogoInfoProgramaMedicoDipreca(null, true, null);
            dialogo.setLocationRelativeTo(null);
            dialogo.limpiarCampos();
            dialogo.setTitle("Agregar Programa médico");
            dialogo.getBotonAceptar().setText("Agregar");
            dialogo.getBotonAceptar().setIcon(new javax.swing.ImageIcon(getClass().getResource("/GUI/Img/Iconos16X16/Agregar.png")));
            dialogo.getBotonCancelar().setText("Cancelar");
            dialogo.inhabilitarCampos();
            dialogo.habilitarCampos();
            dialogo.llenarPaciente(rutPaciente);
            dialogo.setVisible(true);
        } else if (campoJeafosale.isSelected()) {
            DialogoInfoProgramaMedicoJeafosale dialogo = new DialogoInfoProgramaMedicoJeafosale(null, true, null);
            dialogo.setLocationRelativeTo(null);
            dialogo.limpiarCampos();
            dialogo.setTitle("Agregar Programa médico");
            dialogo.getBotonAceptar().setText("Agregar");
            dialogo.getBotonAceptar().setIcon(new javax.swing.ImageIcon(getClass().getResource("/GUI/Img/Iconos16X16/Agregar.png")));
            dialogo.getBotonCancelar().setText("Cancelar");
            dialogo.inhabilitarCampos();
            dialogo.habilitarCampos();
            dialogo.llenarPaciente(rutPaciente);
            dialogo.setVisible(true);
        } else {//fonasa
            DialogoInfoProgramaMedicoFonasa dialogo = new DialogoInfoProgramaMedicoFonasa(null, true, null);
            dialogo.normalizarMensajeria();
            dialogo.setLocationRelativeTo(null);
            dialogo.limpiarCampos();
            dialogo.setTitle("Agregar Programa médico");
            dialogo.getBotonAceptar().setText("Agregar");
            dialogo.getBotonAceptar().setIcon(new javax.swing.ImageIcon(getClass().getResource("/GUI/Img/Iconos16X16/Agregar.png")));
            dialogo.getBotonCancelar().setText("Cancelar");
            dialogo.inhabilitarCampos();
            dialogo.habilitarCampos();
            dialogo.setVisible(true);
        }
    }//GEN-LAST:event_botonAceptarTCActionPerformed

    private void botonCancelarTCActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonCancelarTCActionPerformed
        this.dispose();
    }//GEN-LAST:event_botonCancelarTCActionPerformed

   
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton botonAceptarTC;
    private javax.swing.JButton botonCancelarTC;
    private javax.swing.JRadioButton campoDipreca;
    private javax.swing.JRadioButton campoFonasa;
    private javax.swing.JRadioButton campoJeafosale;
    // End of variables declaration//GEN-END:variables
}
